using System;
using System.Collections.Generic;
using System.Text;

namespace CKS.EWE.Controls
{
    static class TokenUtils
    {

        internal struct WikiToken
        {
            internal string sBeginToken;
            internal string sEndToken;
            internal string sBeginMarkup;
            internal string sEndMarkup;
            internal string sDescription;
        }

        /// <summary>
        /// Get collection of Tokens that are hardcoded
        /// </summary>
        /// <returns>List of WikiToken structures</returns>
        public static IEnumerable<TokenUtils.WikiToken> GetDefaultWikiTokens()
        {
            /* TODO: Tokens to add support for (in no particular order):
             *      quote 
             *      strikethrough
             *      colored text
             *      ordered/unordered lists
             * 
             */

            List<TokenUtils.WikiToken> returnTokens = new List<TokenUtils.WikiToken>();
            TokenUtils.WikiToken wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "**";
            wt.sEndToken = "**";
            wt.sBeginMarkup = "<strong>";
            wt.sEndMarkup = "</strong>";
            wt.sDescription = "**bold**";
            returnTokens.Add(wt);

            //<hr /> token needs to come before <u> token to avoid conflict!
            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "___";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<hr />";
            wt.sEndMarkup = "";
            wt.sDescription = "___ = &lt;hr&gt;";
            returnTokens.Add(wt);
            
            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "__";
            wt.sEndToken = "__";
            wt.sBeginMarkup = "<u>";
            wt.sEndMarkup = "</u>";
            wt.sDescription = "__underline__";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "##";
            wt.sEndToken = "##";
            wt.sBeginMarkup = "<i>";
            wt.sEndMarkup = "</i>";
            wt.sDescription = "##italicized##";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~bq";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<blockquote>";
            wt.sEndMarkup = "</blockquote>";
            wt.sDescription = "~bq=&lt;blockquote&gt;";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~h1";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<h1>";
            wt.sEndMarkup = "</h1>";
            wt.sDescription = "~h1 = &lt;h1&gt;";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~h2";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<h2>";
            wt.sEndMarkup = "</h2>";
            wt.sDescription = "~h2 = &lt;h2&gt;";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~h3";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<h3>";
            wt.sEndMarkup = "</h3>";
            wt.sDescription = "~h3 = &lt;h3&gt;";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~h4";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<h4>";
            wt.sEndMarkup = "</h4>";
            wt.sDescription = "~h4 = &lt;h4&gt;";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~h5";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<h5>";
            wt.sEndMarkup = "</h5>";
            wt.sDescription = "~h5 = &lt;h5&gt;";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~h6";
            wt.sEndToken = "End of Paragraph";
            wt.sBeginMarkup = "<h6>";
            wt.sEndMarkup = "</h6>";
            wt.sDescription = "~h6 = &lt;h6&gt;";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "^^";
            wt.sEndToken = "^^";
            wt.sBeginMarkup = "<sup>";
            wt.sEndMarkup = "</sup>";
            wt.sDescription = "^^superscript^^";
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "{code}";
            wt.sEndToken = "{code}";
            wt.sBeginMarkup = "<code>";
            wt.sEndMarkup = "</code>";
            wt.sDescription = "{code}source code{code}" ;
            returnTokens.Add(wt);

            wt = new TokenUtils.WikiToken();
            wt.sBeginToken = "~~";
            wt.sEndToken = "~~";
            wt.sBeginMarkup = "<sub>";
            wt.sEndMarkup = "</sub>";
            wt.sDescription = "~~subscript~~";
            returnTokens.Add(wt);




            return returnTokens;
        }

    }
}
